/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.click.app.model;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author orgale
 */
@Entity
@Table(name = "material_return")
@NamedQueries({@NamedQuery(name = "MaterialReturn.findAll", query = "SELECT m FROM MaterialReturn m"), @NamedQuery(name = "MaterialReturn.findByIdMaterialReturn", query = "SELECT m FROM MaterialReturn m WHERE m.idMaterialReturn = :idMaterialReturn"), @NamedQuery(name = "MaterialReturn.findByDate", query = "SELECT m FROM MaterialReturn m WHERE m.date = :date"), @NamedQuery(name = "MaterialReturn.findByQuantity", query = "SELECT m FROM MaterialReturn m WHERE m.quantity = :quantity")})
public class MaterialReturn extends BaseObject implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    private Integer idMaterialReturn;
    private Date date;
    private Double quantity;
//    @JoinColumn(name = "id_purchase_detail", referencedColumnName = "id_purchase_detail")
//    @ManyToOne
//    private PurchaseDetail idPurchaseDetail;
//    @OneToMany(cascade = CascadeType.ALL, mappedBy = "materialReturn")
//    private Collection<ReturnPayment> returnPaymentCollection;

    public MaterialReturn() {
    }

    public MaterialReturn(Integer idMaterialReturn) {
        this.idMaterialReturn = idMaterialReturn;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "id_material_return")
    public Integer getIdMaterialReturn() {
        return idMaterialReturn;
    }

    public void setIdMaterialReturn(Integer idMaterialReturn) {
        this.idMaterialReturn = idMaterialReturn;
    }

    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Column(name = "quantity")
    public Double getQuantity() {
        return quantity;
    }

    public void setQuantity(Double quantity) {
        this.quantity = quantity;
    }

//    public PurchaseDetail getIdPurchaseDetail() {
//        return idPurchaseDetail;
//    }
//
//    public void setIdPurchaseDetail(PurchaseDetail idPurchaseDetail) {
//        this.idPurchaseDetail = idPurchaseDetail;
//    }
//
//    public Collection<ReturnPayment> getReturnPaymentCollection() {
//        return returnPaymentCollection;
//    }
//
//    public void setReturnPaymentCollection(Collection<ReturnPayment> returnPaymentCollection) {
//        this.returnPaymentCollection = returnPaymentCollection;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMaterialReturn != null ? idMaterialReturn.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaterialReturn)) {
            return false;
        }
        MaterialReturn other = (MaterialReturn) object;
        if ((this.idMaterialReturn == null && other.idMaterialReturn != null) || (this.idMaterialReturn != null && !this.idMaterialReturn.equals(other.idMaterialReturn))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.click.app.model.MaterialReturn[idMaterialReturn=" + idMaterialReturn + "]";
    }

}
